*************************************************************************************************
************************************** I want to believe: ***************************************
******** The relationship between conspiratorial beliefs and populist attitudes in Spain ********
*************************************************************************************************
*************************************** Electoral Studies ***************************************
*************************************************************************************************

********************************* Marc Guinjoan & Carol Galais **********************************


****** STUDY 1 ******

use study1, clear

global controls "female age education interest ideol"
set scheme s1mono 

***Table 3:Correlation matrix
pwcorr ippl ielt imnq ipopmult consp_scale4, sig

***Figure 1: Histogram Conspiracy
foreach var of varlist cons_* {
local graphtitle : variable label `var'
hist `var', title(`graphtitle')  bin(9) xtitle("") xlabel(0.21 `""Absolutely" "false""' 1.1 `""Somewhat" "false""' 1.99 `""Neither true" "nor false""'  2.89 `""Somewhat" "true""' 3.77 `""Absolutely  " "true  ""') color(%60) scale(0.8) name(hist_`var', replace) 
graph close
}

graph  combine hist_cons_farma hist_cons_secret hist_cons_11s hist_cons_alien , col(2) name(f1_histogram, replace)
graph export "f1_histogram.pdf", replace

***Figure 2: Tests for spuriousness. Conspiratorial Beliefs, populist attitudes and confounders
foreach var of varlist ippl ielt imnq ipopmult {
eststo Baseline_`var': reg `var' $controls consp_scale4
eststo Authority_`var': reg `var' $controls consp_scale4 s_autority
eststo Efficacy_`var': reg `var' $controls consp_scale4 efipolin
eststo NFC_`var': reg `var' $controls consp_scale4 incognition
eststo FI_`var': reg `var' $controls consp_scale4 iintuitive
eststo Full_`var': reg `var' $controls consp_scale4 s_autority efipolin incognition iintuitive
}

coefplot Baseline_ippl Authority_ippl Efficacy_ippl NFC_ippl FI_ippl Full_ippl, bylabel(People-centrism) ||  Baseline_ielt Authority_ielt Efficacy_ielt NFC_ielt FI_ielt Full_ielt, bylabel(Anti-elitism) ||  Baseline_imnq Authority_imnq Efficacy_imnq NFC_imnq FI_imnq Full_imnq, bylabel(Manicheism) || Baseline_ipopmult Authority_ipopmult Efficacy_ipopmult NFC_ipopmult FI_ipopmult Full_ipopmult, bylabel(Populism (Goertzian)) ||,  byopts(compact cols(4)) drop (_cons female education age interest ideol) levels(95 90) coeflabels(consp_scale4= "Conspiratorial beliefs" iintuitive = "Faith in intuition"  incognition = "Need for cognition" s_autority ="Opinion on authority"  efipolin="Internal political efficacy") labels headings(s_autority="{bf:Attitudes towards authority}" efipolin="{bf:Political efficacy}" incognition= "{bf:Cognitive style and sophistication}") xline(0, lcolor(dkorange) lp(shortdash)) xtitle("Change in populist attitudes", height(15) size(small)) legend(order(3 "Baseline" 6 "Authority" 9 "Efficacy" 12 "NFC" 15 "FI" 18 "Full model") row(1) size(small)) name(f2_coefplot, replace) 
gr_edit gmetric_mult = 0.7
gr_edit note.text = {}
gr_edit note.text.Arrpush `"Whiskers display 90% and 95%& confidence intervals"'
gr_edit note.style.editstyle box_alignment(seast) editcopy
gr_edit b1title.DragBy -.6255598341546547 18.18545675212967
gr_edit note.DragBy -2.64993517267887 .2132350100507855
gr_edit  legend.DragBy -1.907953324328785 .106617505025385

graph export "f2_coefplot.pdf", replace

***Table S2a: Statistic descriptives for Study 1
quiet reg ippl $controls consp_scale4
sum ippl ielt imnq ipopmult consp_scale4  s_autority efipolin incognition iintuitive $controls if e(sample)


***Table S2c: Correlation matrix of the different items taping into populist attitudes
pwcorr ppl1 ppl2r ppl3 elt1 elt2r elt3 mnq1 mnq2r mnq3, sig

factor ppl1 ppl2r ppl3 elt1 elt2r elt3 mnq1 mnq2r mnq3, factor(3)
factor ppl1 ppl2r ppl3 
factor elt1 elt2r elt3 
factor mnq1 mnq2r mnq3

gen pc2 = ppl1*ppl3
gen ae2 = elt2*elt3
gen mn2 = mnq1*mnq3

gen pop2mult = pc2*ae2*mn2

***Table S2e. Results for the tests for spuriousness
eststo clear
foreach var of varlist ippl ielt imnq ipopmult {
eststo full_`var': reg `var' $controls consp_scale4 s_autority efipolin incognition 
} 
esttab using "tableS2c.rtf", mtitles ("People-centrism" "Anti-elitism" "Manicheism" "Populism (Goertzian)") label nonumbers coeflabels(_cons "Constant" ) nogaps starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(3) se(3) r2 replace

***Table S3b: Mediation analysis of CB on populist attitudes via different confounders, Study 1
foreach dv of varlist ippl ielt imnq ipopmult {
foreach med of varlist s_autority efipolin incognition iintuitive {
medeff (regress `med' consp_scale4 $controls) (regress `dv' consp_scale4  `med' $controls), med(`med') treat(consp_scale4) level(95)
}
}

***************************************************************************************************

****** STUDY 2 ******

use study2, clear 

eststo: reg conspiracyscale i.treatment secret
eststo: reg conspiracyscale i.treatment ideol edu cognition interest
esttab using "treatment.rtf", mtitles ("No controls" "Controls") label nonumbers coeflabels(_cons "Constant" ) nogaps starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(3) se(3) r2 replace

foreach var of varlist conspiracy1 conspiracy2 conspiracy3 conspiracyscale {
reg `var' i.treatment
reg `var' i.treatment ideol edu cognition interest
} // the treatment worked

*Summary statistics
bysort treatment: alpha conspiracy1 conspiracy2 conspiracy3, item asis
alpha ppl1 ppl2r ppl3, item asis
alpha elt1 elt2r elt3, item asis
alpha mnq1 mnq2r mnq3, item asis

quiet reg ippl treatment ideol edu cognition interest
sum ippl ielt imnq ipopmult treatment ideol edu cognition interest if e(sample)
bysort treatment: sum conspiracyscale

***Figure 3: Treatment effect on the different dimensions of populism
eststo clear
foreach var of varlist ippl ielt imnq ipopmult {
eststo m1`var': reg `var' treatment
eststo m2`var': reg `var' treatment ideol edu cognition interest
eststo m3`var': reg `var' treatment ideol edu cognition interest secret
}

coefplot (m1ippl \ m1ielt \ m1imnq \ m1ipopmult ), sch(s1mono)  drop (_cons ) aseq swapnames levels(95 90) coeflabels(m1ippl= "People-centrism" m1ielt="Anti-elitism" m1imnq="Manicheism" m1ipopmult ="Populism (Goertzian)") xtitle("Treatment effect", height(6)) ytitle("Dimension of populism") xline(0, lcolor(dkorange) lp(shortdash)) legend(off) scale(0.8) note("Whisters display 90% and 95%& confidence intervals", pos(7) size(vsmall)) name(f3_treatment, replace)
graph export "f3_treatment.pdf", replace

esttab m*ippl m*ielt using "conspiracy.rtf", mtitles ("PC" "PC" "PC" "AE" "AE" "AE") label nonumbers coeflabels(_cons "Constant" ) nogaps starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(3) se(3) r2 replace
esttab m*imnq m*ipopmult using "conspiracy.rtf", mtitles ("MN" "MN" "MN" "Pop" "Pop" "Pop") label nonumbers coeflabels(_cons "Constant" ) nogaps starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(3) se(3) r2 append

***Table S2d: Correlation matrix of the different items taping into populist attitudes
pwcorr ppl1 ppl2r ppl3 elt1 elt2r elt3 mnq1 mnq2r mnq3

***Table S4a. Randomization Test for Study 2. Unpaired T-test
reg conspiracyscale i.treatment
foreach var of varlist conspiracyscale age sex edu ideol interest cognition {
sum `var'
ttest `var' if e(sample), by(treatment)
}

***Table S5a. Treatment effects on the different dimensions of populist, Study 2
eststo clear
foreach var of varlist ippl ielt  imnq ipopmult  {
eststo m1`var': reg `var' treatment
eststo m2`var': reg `var' treatment ideol edu cognition interest
}
esttab using "tables5a_experiment.rtf", mtitles ("PC" "PC" "AE" "AE" "MN" "MN" "Pop" "Pop") label nonumbers coeflabels(_cons "Constant" ) nogaps starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(3) se(3) r2 replace

***Table 5b. Is there an age effect?

recode age (17/34=1 "Age: 17-34") (35/75=2 "Age: 35+"), gen(age2)

eststo clear
foreach var of varlist ippl ielt imnq ipopmult {
eststo m1`var': reg `var' i.treatment
eststo m2`var': reg `var' i.treatment if age2==1
eststo m3`var': reg `var' i.treatment if age2==2
}

esttab m*ippl m*ielt using "tables_age.rtf", mtitles ("PC" "PC" "PC" "AE" "AE" "AE" ) label nonumbers coeflabels(_cons "Constant" ) drop(0.treatment* ) nogaps starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(3) se(3) r2 replace

esttab m*imnq m*ipopmult using "tables_age.rtf", mtitles ("MN" "MN" "MN" "Pop" "Pop" "Pop") label nonumbers coeflabels(_cons "Constant" ) drop(0.treatment* ) nogaps starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(3) se(3) r2 append

********************************************************************************************

****** STUDY 1 & 2 ******
use study1.dta, clear
rename female sex
rename incognition cognition
rename consp_scale4  conspiracyscale
rename education edu

drop cons_farma  cons_secret cons_11s  cons_alien iintuitive  efipolin s_autority 

gen survey=1

append using study2.dta

replace survey=2 if survey==.

drop treatment conspiracy*

foreach var of varlist ippl ielt imnq ipopmult {
sum `var'
ttest `var', by(survey)
}

twoway (kdensity ipopmult if survey==1, lcolor(dkorange) lp(shortdash) lwidth(0.4)) (kdensity ipopmult if survey==2, lcolor(gray) lp(longdash) lwidth(0.4) legend(order(1 "Study 1" 2 "Study 2")) ytitle(Density) xtitle(""Populist Attitudes (Goertzian)))

*****************************************************************************************

***Manicheism negatively correlated with other populist attitudes?
use livewhat, clear
cor popagreepopulism_1 popagreepopulism_2 popagreepopulism_3 popagreepopulism_4 popagreepopulism_5 popagreepopulism_6 popagreepopulism_7 popagreepopulism_8

***END DO-FILE.